<template>
  <div id="app">
    <v-md-editor :include-level="[2]" v-model="text" height="800px" />
    <!-- 下面这个方法可以实现预览 -->
    <!--<v-md-editor :value="text" mode="preview"></v-md-editor>-->
    <!-- 官网说下面这个方式可以用，但是实测无法转换 -->
    <!--<v-md-preview :text="text" />-->
  </div>
</template>

<script>
import VMdPreview from '@kangc/v-md-editor/lib/preview'
import '@kangc/v-md-editor/lib/style/preview.css'

export default {
  components: {
    VMdPreview
  },
  data() {
    return {
      text: '<customheading>刷新 refresh_token</customheading>\n\n授权整体流程详见<a href="https://developer.open-douyin.com/docs/resource/zh-CN/dop/develop/sdk/mobile-app/permission/overall-permission" target="_blank">授权概述</a>。\n\n该接口用于刷新 refresh_token 的有效期。\n\n该接口适用于**抖音**授权。\n\n## 接口说明\n\n### 使用前提\n\nclient_key 必须拥有 **renew_refresh_token** 权限。\n\n### 注意事项\n\n<ul><li>抖音的 OAuth API 以<code>https://open.douyin.com/</code> 开头。</li><li><span style="color: #24292E;"><span style="font-size: 14px;">刷新操作需要在 refresh_token 过期前进行。</span></span></li><li>通过旧的 refresh_token 获取新的 refresh_token，调用后旧 refresh_token 会失效，新 refresh_token 有 30 天有效期。最多只能获取 5 次新的 refresh_token，<strong>5 次过后需要用户重新授权</strong>。</li></ul>\n\n## 请求地址\n\n<table style="width: 651px;"><colgroup><col style="width: 140px;"><col style="width: 511px;"></colgroup><tbody><tr><th colspan="1" rowspan="1" data-colwidth="140"><p>HTTP URL</p></th><th colspan="1" rowspan="1" data-colwidth="511"><p>正式环境：https://open.douyin.com/oauth/renew_refresh_token/</p><p>沙盒环境：https://open-sandbox.douyin.com/oauth/renew_refresh_token/</p></th></tr><tr><td colspan="1" rowspan="1" data-colwidth="140"><p>HTTP Method</p></td><td colspan="1" rowspan="1" data-colwidth="511"><p>POST</p></td></tr></tbody></table>\n\n## 请求头\n\n<table style="width: 673px;"><colgroup><col style="width: 136px;"><col style="width: 100px;"><col style="width: 100px;"><col style="width: 337px;"></colgroup><tbody><tr><th colspan="1" rowspan="1" data-colwidth="136"><p><strong>名称</strong></p></th><th colspan="1" rowspan="1" data-colwidth="100"><p><strong>类型</strong></p></th><th colspan="1" rowspan="1" data-colwidth="100"><p><strong>必填</strong></p></th><th colspan="1" rowspan="1" data-colwidth="337"><p><strong>描述</strong></p></th></tr><tr><td colspan="1" rowspan="1" data-colwidth="136"><p>Content-Type</p></td><td colspan="1" rowspan="1" data-colwidth="100"><p>string</p></td><td colspan="1" rowspan="1" data-colwidth="100"><p>是</p></td><td colspan="1" rowspan="1" data-colwidth="337"><p>固定值 "application/x-www-form-urlencoded"</p></td></tr></tbody></table>\n\n## 请求参数\n\n### Body 请求\n\n<table style="width: 867px;"><colgroup><col style="width: 143px;"><col style="width: 100px;"><col style="width: 100px;"><col style="width: 245px;"><col style="width: 279px;"></colgroup><tbody><tr><th colspan="1" rowspan="1" data-colwidth="143"><p><strong>名称</strong></p></th><th colspan="1" rowspan="1" data-colwidth="100"><p><strong>类型</strong></p></th><th colspan="1" rowspan="1" data-colwidth="100"><p><strong>是否必填</strong></p></th><th colspan="1" rowspan="1" data-colwidth="245"><p><strong>描述</strong></p></th><th colspan="1" rowspan="1" data-colwidth="279"><p><strong>示例值</strong></p></th></tr><tr><td colspan="1" rowspan="1" data-colwidth="143"><p>client_key</p></td><td colspan="1" rowspan="1" data-colwidth="100"><p>string</p></td><td colspan="1" rowspan="1" data-colwidth="100"><p>是</p></td><td colspan="1" rowspan="1" data-colwidth="245"><p>应用唯一标识</p></td><td colspan="1" rowspan="1" data-colwidth="279"><p>aw05az2qjv******</p></td></tr><tr><td colspan="1" rowspan="1" data-colwidth="143"><p>refresh_token</p></td><td colspan="1" rowspan="1" data-colwidth="100"><p>string</p></td><td colspan="1" rowspan="1" data-colwidth="100"><p>是</p></td><td colspan="1" rowspan="1" data-colwidth="245"><p>填写通过 access_token 获取到的 refresh_token 参数</p></td><td colspan="1" rowspan="1" data-colwidth="279"><p>rft.a736b70544519999a623d67a1ecc1d395ubdim55A7h4S3lN2qs54J******</p></td></tr></tbody></table>\n\n## 请求示例\n\n```js\ncurl --location --request POST \'https://open.douyin.com/oauth/renew_refresh_token/\' \\\n--header \'Content-Type: application/x-www-form-urlencoded\' \\\n--data-urlencode \'client_key=aw05az2qjv******\' \\\n--data-urlencode \'refresh_token=rft.a736b70544519999a623d67a1ecc1d395ubdim55A7h4S3lN2qs54J******\'\n```\n\n## 响应参数\n\n<table style="width: 645px;"><colgroup><col style="width: 134px;"><col style="width: 100px;"><col style="width: 189px;"><col style="width: 222px;"></colgroup><tbody><tr><th colspan="1" rowspan="1" data-colwidth="134"><p>名称</p></th><th colspan="1" rowspan="1" data-colwidth="100"><p>类型</p></th><th colspan="1" rowspan="1" data-colwidth="189"><p>描述</p></th><th colspan="1" rowspan="1" data-colwidth="222"><p>示例值</p></th></tr><tr><td colspan="1" rowspan="1" data-colwidth="134"><p>message</p></td><td colspan="1" rowspan="1" data-colwidth="100"><p>string</p></td><td colspan="1" rowspan="1" data-colwidth="189"><p><br></p></td><td colspan="1" rowspan="1" data-colwidth="222"><p>success</p></td></tr><tr><td colspan="1" rowspan="1" data-colwidth="134"><p>data</p></td><td colspan="1" rowspan="1" data-colwidth="100"><p>struct</p></td><td colspan="1" rowspan="1" data-colwidth="189"><p><br></p></td><td colspan="1" rowspan="1" data-colwidth="222"><p><br></p></td></tr><tr><td colspan="1" rowspan="1" data-colwidth="134"><p>error_code</p></td><td colspan="1" rowspan="1" data-colwidth="100"><p>int64</p></td><td colspan="1" rowspan="1" data-colwidth="189"><p>错误码</p></td><td colspan="1" rowspan="1" data-colwidth="222"><p>0</p></td></tr><tr><td colspan="1" rowspan="1" data-colwidth="134"><p>expires_in</p></td><td colspan="1" rowspan="1" data-colwidth="100"><p>int64</p></td><td colspan="1" rowspan="1" data-colwidth="189"><p>过期时间，单位（秒）</p></td><td colspan="1" rowspan="1" data-colwidth="222"><p>86400</p></td></tr><tr><td colspan="1" rowspan="1" data-colwidth="134"><p>refresh_token</p></td><td colspan="1" rowspan="1" data-colwidth="100"><p>string</p></td><td colspan="1" rowspan="1" data-colwidth="189"><p>用户刷新</p></td><td colspan="1" rowspan="1" data-colwidth="222"><p>refresh_token</p></td></tr><tr><td colspan="1" rowspan="1" data-colwidth="134"><p>description</p></td><td colspan="1" rowspan="1" data-colwidth="100"><p>string</p></td><td colspan="1" rowspan="1" data-colwidth="189"><p>错误码描述</p></td><td colspan="1" rowspan="1" data-colwidth="222"><p>Parameter error</p></td></tr></tbody></table>\n\n## 响应示例\n\n### 正常示例\n\n```json\n{\n  "data": {\n    "description": "",\n    "error_code": 0,\n    "expires_in": "86400",\n    "refresh_token": "refresh_token"\n  },\n  "message": "success"\n}\n```\n\n### 异常示例\n\n```json\n{\n  "data": {\n    "description": "Parameter error",\n    "error_code": 2100005\n  },\n  "extra": {\n    "logid": "2020070614111601022506808001045D59",\n    "now": 1594015876138\n  }\n}\n```\n\n## 错误码\n\n<table style="width: 861px;"><colgroup><col style="width: 129px;"><col style="width: 100px;"><col style="width: 160px;"><col style="width: 472px;"></colgroup><tbody><tr><th colspan="1" rowspan="1" data-colwidth="129"><p><strong>HTTP 状态码</strong></p></th><th colspan="1" rowspan="1" data-colwidth="100"><p><strong>错误码</strong></p></th><th colspan="1" rowspan="1" data-colwidth="160"><p><strong>描述</strong></p></th><th colspan="1" rowspan="1" data-colwidth="472"><p><strong>排查建议</strong></p></th></tr><tr><td colspan="1" rowspan="1" data-colwidth="129"><p>200</p></td><td colspan="1" rowspan="1" data-colwidth="100"><p>10005</p></td><td colspan="1" rowspan="1" data-colwidth="160"><p>缺少参数</p></td><td colspan="1" rowspan="1" data-colwidth="472"><p>检查是否填写 client_key 和 refresh_token 参数，请求格式是否正确。</p></td></tr><tr><td colspan="1" rowspan="1" data-colwidth="129"><p>200</p></td><td colspan="1" rowspan="1" data-colwidth="100"><p>10004</p></td><td colspan="1" rowspan="1" data-colwidth="160"><p>权限不足</p></td><td colspan="1" rowspan="1" data-colwidth="472"><p>请申请 renew_refresh_token 权限。</p></td></tr><tr><td colspan="1" rowspan="1" data-colwidth="129"><p>200</p></td><td colspan="1" rowspan="1" data-colwidth="100"><p>10010</p></td><td colspan="1" rowspan="1" data-colwidth="160"><p>refresh_token 过期</p></td><td colspan="1" rowspan="1" data-colwidth="472"><p>token 已过期，请让用户重新授权。</p></td></tr><tr><td colspan="1" rowspan="1" data-colwidth="129"><p>200</p></td><td colspan="1" rowspan="1" data-colwidth="100"><p>10020</p></td><td colspan="1" rowspan="1" data-colwidth="160"><p>超过刷新次数限制</p></td><td colspan="1" rowspan="1" data-colwidth="472"><p>无法再刷新，请让用户重新授权。</p></td></tr></tbody></table>\n'
    }
  }
}
</script>
